<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;


Route::get('/', 'index/index');
Route::get('/index', 'index/index');
Route::get('/qiandao', 'index/qiandao');
Route::get('/getuserinfo', 'index/getuserinfo');
Route::get('/uuserimgurl', 'index/uuserimgurl');
Route::get('/uusernickname', 'index/uusernickname');
Route::get('/jingcais', 'index/jingcais');
Route::get('/guoshu', 'index/guoshu');
Route::get('/guoshus', 'index/guoshus');
Route::get('/guoshumy', 'index/guoshumy');
Route::get('/jiaoshui', 'index/jiaoshui');
Route::get('/jingcaijieguo', 'index/jingcaijieguo');
Route::get('/shouqu', 'index/shouqu');

//后台组
Route::group(function () {
    //用户模块路由
    Route::resource('admin', 'Admin');
    Route::resource('adv', 'Adv');
    Route::resource('alg', 'Alg');
    Route::resource('info', 'Info');
    Route::resource('user', 'user');
    Route::resource('jf', 'jf');
    Route::resource('jingcai', 'jingcai');
})->middleware(function ($request, Closure $next) {
    if (!session('?admin')) {
        return redirect('/login');
    }
    return $next($request);
});


//登录模块路由
Route::group(function () {
    Route::get('login', 'Login/index')->middleware(function ($request, Closure $next) {
        if (session('?admin')) {
            return redirect('/');
        }
        return $next($request);
    });
    Route::post('login_check', 'Login/check');
    Route::get('logout', 'Login/out');
});